/**
 * 
 */
package idv.takeshi.software.productline.bookstore.domain.model.order;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;

import org.apache.commons.lang.Validate;

/**
 * A repository for Order.
 * @author takeshi
 *
 */
public interface OrderRepository {
	
	/**
	 * Add an order.
	 * @param order
	 * @throws OrderDuplicateException
	 */
	public abstract void add(Order order) throws OrderDuplicateException;
	
	/**
	 * Remove an order.
	 * @param order
	 */
	public abstract void remove(Order order);
	
	/**
	 * Find an order by id.
	 * @param id
	 * @return
	 */
	public abstract Order findById(Long id);
	
	/**
	 * Find an order by ids.
	 * @param id
	 * @return
	 */
	public abstract Set<Order> findByIds(Long[] id);
	
	/**
	 * Find all orders.
	 * @return
	 */
	public abstract Set<Order> findAll();
	
	/**
	 * Add an invoice.
	 * @param invoice
	 */
	public abstract void add(Invoice invoice);
	
	/**
	 * Remove an invoice.
	 * @param invoice
	 */
	public abstract void remove(Invoice invoice);
	
	/**
	 * Add a payment.
	 * @param payment
	 */
	public abstract void add(Payment payment);
	
	/**
	 * Remove a payment.
	 * @param payment
	 */
	public abstract void remove(Payment payment);

	/**
	 * Update an Order.
	 * @param order
	 */
	public void update(Order order);
	
	/**
	 * Find by multiple criteria.
	 * @param userName
	 * @param recipientName
	 * @param orderStatus
	 * @param fromUpdateTime
	 * @param toUpdateTime
	 * @param fromCreateTime
	 * @param toCreateTime
	 * @param fromPrice
	 * @param toPrice
	 * @return
	 */
	public Set<Order> find(String userName, String recipientName, OrderStatus orderStatus, 
			Date fromUpdateTime, Date toUpdateTime, Date fromCreateTime, Date toCreateTime, 
			BigDecimal fromPrice, BigDecimal toPrice);
}
